package com.emas.pushapi;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;

import org.junit.BeforeClass;

import static org.junit.Assert.assertNotNull;

/**
 * 推送的OpenAPI文档 https://help.aliyun.com/document_detail/mobilepush/api-reference/openapi.html
 */
public class BaseTest {

    protected static String region;
    protected static String deviceIds;
    protected static String deviceId;
    protected static String accounts;
    protected static String account;
    protected static String aliases;
    protected static String alias;
    protected static String tag;
    protected static String tagExpression;

    public static DefaultAcsClient client;
    public static long appKey = 0;
    public static String accessKeyId = "";
    public static String accessKeySecret = "";

    /**
     * 从配置文件中读取配置值，初始化Client
     * <p>
     * 1. 如何获取 accessKeyId/accessKeySecret/appKey 照见README.md 中的说明<br/>
     * 2. 先在 push.properties 配置文件中 填入你的获取的值
     */
    @BeforeClass
    public static void beforeClass() throws Exception {
        assertNotNull("先在 push.properties 配置文件中配置 accessKeyId", accessKeyId);
        assertNotNull("先在 push.properties 配置文件中配置 accessKeySecret", accessKeySecret);

        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
        client = new DefaultAcsClient(profile);
    }
}
